﻿@using System.Collections.Generic;
@using Think.Lenovo.Com.Models;
@using Think.Lenovo.Com.Models.Users;
@using System.Web.Mvc;
@using System.Web.Mvc.Html;
<link href="/Contents/css/skin.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Cache-Control" content="no" />
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #EEF2FB;
}
-->
</style>
<script type="text/javascript" src="/Scripts/lib/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="/Scripts/ViewManageUser.js"></script>
<body>
    <table>
        <tr>
            <td>
                用户名
            </td>
            <td>
                <input type="text" id="UserName" maxlength="50" />
            </td>
            <td>
                密码
            </td>
            <td>
                <input type="password" id="UserPassword" maxlength="16" />
            </td>
            <td>
                角色
            </td>
            <td>
                @{   
                    Dictionary<String, Object> attributes = new Dictionary<string, object>();
                    attributes.Add("onchange", "getRoleLevels(this)");
                    @System.Web.Mvc.Html.SelectExtensions.DropDownList(this.Html, "UserRole", (List<System.Web.Mvc.SelectListItem>)ViewData["UserRole"], attributes);
                }
                等级:
                <select id="UserLevelId" style="width: auto;">
                    <option value="">- 请选择 - </option>
                </select>
                <!-- 用户状态 -->
                <input type="hidden" id="UserState" value="2" />
            </td>
            <td>
                <input type="button" name="" value="保存用户" onclick="SaveUser();" />
                <input type="hidden" id="Id" value="undefined" />
                <input type="button" id="CancelEditBtn" value="取消修改" onclick="reset();" disabled="disabled" />
            </td>
        </tr>
    </table>
    <hr />
    <table id="userList" style="table-layout: auto;" width="100%" cellpadding="0" cellspacing="0">
        <tr>
            <td align="center">
                <font color='green'>用户Id</font>
            </td>
            <td align="center">
                <font color='green'>用户名</font>
            </td>
            <td>
                <font color='green'>真实姓名</font>
            </td>
            <td align="center">
                <font color='green'>所属角色</font>
            </td>
            <td align="center">
                <font color='green'>用户等级</font>
            </td>
            <td align="center">
                <font color='green'>用户状态</font>
            </td>
            <td align="center"><font color='green'>操作</font></td>
        </tr>
        @{
            foreach (ViewUserModel u in (LinkedList<ViewUserModel>)ViewData["list"])
            {
            <tr>
                <td align="center">@u.Id
                </td>
                <td align="center">@u.UserName
                </td>
                <td align="center">@u.RealName
                </td>
                <td align="center">@u.UserRoleName
                </td>
                <td align="center">@u.UserLevelName
                </td>
                <td align="center">@u.UserStateName
                </td>
                <td align="center">
                    <a href="#" onclick="setState(@u.Id,1);">开启</a> |
                    <a href="#" onclick="setState(@u.Id,2);">锁定</a> |
                    <a href="#" onclick="setState(@u.Id,3);">删除</a> |
                    <a href="#" onclick="setPower(@u.Id);">分配权限</a>
                </td>
            </tr>
            }
        }
    </table>
</body>
